ohi logo
OHI-Northeast | OHI Science | Citation policy

Summary

The Gross Domestic Product (GDP) layer is calculated using coastal GDP data from the National Ocean Economics Program.


Data source

National ocean Economics Program (NOEP)

Downloaded: Manually downloaded on July 3, 2018.
Description: GDP [2012 $USD] per sector for RI, ME, MA, CT, NY and NH counties from 2005 to 2014. The data also include number of establishments, jobs and wages for each sector - state - year.
Native data resolution: County level
Time range: 2005 - 2015
Format: Tabular

NOTES

  • The data was cleaned in the liv/clean_noep_data.R script.
  • All GDP values are reported in 2012 US Dollars.

Load data

Read in the NOEP data and remove a couple columns we don’t need. We can also filter for “All Ocean Sectors” since this goal is not sector specific.

noep_data = read.csv("../liv/data/clean_noep_data.csv") %>%
  select(-X, -Establishments, -Employment, -Wages) %>%
  filter(Sector == "All Ocean Sectors")

Visualize data

ggplot(noep_data, aes(x = Year, y = GDP, color = County)) +
  geom_line() +
  theme_bw() +
  facet_trelliscope(~rgn_name, scales = "free", self_contained = T, width = 800)

Meta-analysis

To identify some inconsistencies I see in the data, I’m going to take a look at the reported GDP at both the county level and statewide. One would expect that the sum of the county employment values would equal what is reported for the “Statewide” employment values. It seems that this is not the case.

states <-  c("Maine", "New Hampshire", "Rhode Island", "Massachusetts", "Connecticut")

meta <- function(state){
  
  all <- noep_data %>%
    filter(State == !!state,
           str_detect(County, "All")) %>%
    select(Year, GDP) %>%
    rename(all_ctys_gdp = GDP)
  
  out <- noep_data %>%
    filter(State == !!state,
           str_detect(County, "All") == FALSE) %>%
    select(State, County, Year, GDP) %>%
    group_by(Year) %>%
    summarize(totals = sum(GDP, na.rm = T)) %>%
    left_join(all) %>%
    rename(county_totals = totals,
           statewide = all_ctys_gdp) %>%
    gather(key = spatial_res, value = GDP, -Year) %>%
    mutate(State  = !!state)
  
  return(out)
}

t <- map_df(states, meta) %>%
  distinct()

ggplot(t, aes(x = Year, y = GDP, color = spatial_res)) +
  geom_line() +
  theme_bw() +
  facet_wrap(~State, scales = "free") +
  scale_color_manual(" ", labels = c("County", "State"), values = c("blue", "red")) 

There are some clear discrepencies between these two time series. What we see here is similar to what we see when we look at the jobs data. We can apply the same logic here as we did there. We will use the County level information for Massachusetts and New Hampshire, and the State level data for the remaining three states.


Assign spatial scale to use

Using the information gained from the meta analysis above, I’m assigning which spatial scale to use for each of the five states. For Maine, Connecticut and Rhode Island we are going to use the State level data, which means we filter for rows that say “All [state] counties” and remove the rest. For Massachusetts and New Hampshire we want to keep only the individual county information and then summarize total number of jobs from that data. Finally we join the two datasets.

#select the data for ME, CT and RI, which is going to use the data reported for "All x counties"
state_data <- noep_data %>%
  filter(str_detect(County, "All"),
         State %in% c("Maine", "Connecticut", "Rhode Island")) %>%
  select(state = State, year = Year, rgn_id, rgn_name, rgn_gdp = GDP)
  
#select the data for MA and NH
county_data <- noep_data %>%
  filter(str_detect(County, "All")== FALSE,
         State %in% c("New Hampshire", "Massachusetts")) %>%
  group_by(rgn_id, Year) %>%
  mutate(rgn_gdp = sum(GDP, na.rm = T)) %>%  #GDP by region
  select(state = State, year = Year, rgn_id, rgn_name, rgn_gdp) %>%
  distinct()

gdp_data_clean <- bind_rows(state_data, county_data)

ggplot(gdp_data_clean, aes(x = year, y = rgn_gdp, color = rgn_name)) +
  geom_line() +
  theme_bw() +
  labs(x = "Year",
       y = "GDP (2012 $USD)",
       color = "Region",
       title = "Gross Domestic Product")

***

Calculate annual growth rate

The annual GDP growth rate is calculated by comparing every year’s GDP total to the average of the previous 3 years.

gdp <- gdp_data_clean %>%
  arrange(year) %>%
  group_by(rgn_id) %>%
  mutate(gdp_avg_3yr = rollapply(rgn_gdp, 3, FUN = mean, align = "right", na.rm = F, partial = T), #calculate the mean for three years
         gdp_prev_3yr = lag(gdp_avg_3yr, n = 1), #create a new column that aligns the avg wages from previous three years with the year with which we're comparing.
         gdp_growth_rate = ifelse(year %in% c(2005:2007), NA, (rgn_gdp/gdp_prev_3yr)-1)) %>% #assign NA to the first three years in the time series because there is not enough data to calculate this rate. 2007 growth rate *should* be compared to average of 2004-2006.
  write_csv("int/coastal_gdp_data.csv") %>%
  select(state, year, rgn_id, rgn_name, gdp_growth_rate)


write.csv(gdp, file.path(dir_calc, "layers/eco_coast_gdp.csv"))
  
ggplot(gdp%>%filter(!is.na(gdp_growth_rate)), aes(x = year, y = gdp_growth_rate, color = rgn_name)) +
    geom_line() +
    labs(y = "Annual GDP growth rate (%)",
         x = "Year",
         color = "Region") +
    geom_hline(yintercept = 0) +
    theme_bw()


References

National Ocean Economics Program. Ocean Economic Data by Sector & Industry., ONLINE. 2012. Available: http://www.OceanEconomics.org/Market/oceanEcon.asp [3 October 2017]